package com.bugRecord.action;

import java.io.PrintWriter;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.bugRecord.bean.Bug;
import com.bugRecord.service.IOperateService;
import com.bugRecord.service.ServiceFactory;
import com.bugRecord.service.show.IShowMoreService;
import com.bugRecord.service.show.ShowMoreFactory;

public class SearchBugAction implements LaborcAction {

	public void execute(HttpServletRequest req, HttpServletResponse resp)
			throws Exception {
		String bugName = req.getParameter("searchContent");
		IShowMoreService service = ShowMoreFactory.createService("bug");
		List<Object> listo = service.showMoreObject(bugName);
		StringBuffer results = new StringBuffer("<ul>");
		resp.setContentType("text/html");
		for(Object o :listo)
		{
			Bug bug = (Bug)o;
		    results.append("<li>"+bug.getBugName()+"</li>");
		}
		results.append("<ul>");
		PrintWriter out = resp.getWriter();
		out.println(results);
		out.close();
	}

}
